package com.fhz.kotlinstest.truepaging

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContentProviderCompat.requireContext
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.fhz.kotlinstest.R
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class TruePagingActivity : AppCompatActivity() {

    val viewModel:PagingViewModel by viewModels()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_true_paging)
        val recycleView : RecyclerView=  findViewById(R.id.rv_rv)
        val mAppStorePagingAdapter = AppStorePagingAdapter()
        recycleView.adapter = mAppStorePagingAdapter
        recycleView.layoutManager = LinearLayoutManager(this)

        lifecycleScope.launchWhenCreated {
            viewModel.getClassifyData(1).collect {
                mAppStorePagingAdapter.submitData(it)
            }
        }
    }
}